import { ElMessageBox, ElNotification } from 'element-plus'

const notifyConfig = {
  duration: 2000,
  showClose: true
}

export const success = (message = '操作成功！', title = '信息') => {
  ElNotification({ type: 'success', title, message, ...notifyConfig })
}

export const error = (message = '操作失败！', title = '信息') => {
  ElNotification({ type: 'error', title, message, ...notifyConfig })
}
export const warning = (message = '操作失败！', title = '警告') => {
  ElNotification({ type: 'warning', title, message, ...notifyConfig })
}

export const confirm = (message = '确定删除吗？', info = '提示') => {
  return ElMessageBox.confirm(message, info, {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning'
  })
}
export const alert = (message = '', info = '提示') => {
  return ElMessageBox.alert(message, info, {
    confirmButtonText: '确定'
  })
}
